//
//  UIButton+Extension.swift
//  VISUAL
//
//  Created by 刘森 on 2019/12/6.
//  Copyright © 2019 admin. All rights reserved.
//

import Foundation
import UIKit

extension UIButton {
    convenience init(textColor: UIColor, textFont: UIFont) {
        self.init()
        self.titleLabel?.font = textFont
        self.setTitleColor(textColor, for: .normal)
    }
    convenience init(normalImage: UIImage, selectedImage:UIImage? = nil)  {
        self.init()
        self.setImage(normalImage, for: .normal)
        self.setImage(selectedImage, for: .selected)
    }
    
    func setColorAndFont(textColor: UIColor, textFont: UIFont) {
        self.titleLabel?.font = textFont
        self.setTitleColor(textColor, for: .normal)
    }
    
    func setImage(normalImage: UIImage, selectedImage:UIImage? = nil)  {
        self.setImage(normalImage, for: .normal)
        self.setImage(selectedImage, for: .selected)
    }
    
}
